package masterlink.sarPoint.process;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import masterlink.sarPoint.Start;
import masterlink.sarPoint.util.Util;
import masterlink.sarPoint.vo.FitxTick;
import masterlink.sarPoint.vo.MKLine;
public class Tick extends Thread{
	private static final String p="|";
	private static final Logger log=LoggerFactory.getLogger(Tick.class);
	
	@Override
	public void run(){
		log.info("Tick is start");
		int wait = 5000;
		while(true){
			try {
				Thread.sleep(wait);
				printK();
//				printHK();
			} catch (Exception e) {
				log.error("error:{}",e);
			}
			
		}
	}
	private void printHK(){
		for(MKLine mkl:Start.lmk){
			log.info(mkl.getCtime()+p+mkl.getoPrice()+p+mkl.gethPrice()+p+mkl.getlPrice()+p+mkl.getcPrice()+p+mkl.getQty()+p+mkl.getPrice());
		}
	}
	private void printK(){
		for(int i=0;i<301;i++){
			FitxTick ft = Start.getTick(i);
			if(ft!=null){
				log.info(Start.dateTag+p+Util.getTickTime(i,1)+p+i+p+ft.getoPrice()+p+ft.gethPrice()+p+ft.getlPrice()+p+ft.getcPrice()+p+ft.getsQty()+p+ft.getQtyPrice()+p);
			}
		}
	}
}
